var express = require('express');
var webPageUtil = require('./webPageUtil');

var app = express();

app.get('/getHtml', async function(req, res) {
    const content = await webPageUtil.getHtml('https://www.qingning6.com/template-search?text=logo');
    res.send(content);
})

app.get('*', async function(req, res) {
    // const url = req.protocol + '://'+ req.hostname + ':8082' + req.originalUrl  // 本地
    const url = 'https://www.qingning6.com' + req.originalUrl
    console.log(url, '22222222222222222222')
    const content = await webPageUtil.getHtml(url);
    res.send(content);
})

var server = app.listen(8182, function () {
    var port = server.address().port;
    console.log("SEO转换服务已开启，端口号为：%s", port)
});

